package com.itboye.hutouben.presenter;

import com.itboye.hutouben.bean.HomeMallBean;
import com.itboye.hutouben.bean.ShopIngMallBean;
import com.itboye.hutouben.interfaces.IHomeRadMall;
import com.itboye.hutouben.interfaces.IShopIngMallInterface;
import com.itboye.hutouben.responsitory.HomeMallprinsitory;
import com.itboye.hutouben.responsitory.ShopIngMallprinsitory;
import com.itboye.hutouben.volley.BaseNetRepository;
import com.itboye.hutouben.volley.ICompleteListener;
import com.itboye.hutouben.volley.ResultEntity;

import java.util.Observer;

import static com.itboye.hutouben.presenter.BasePresenter.Tag_Success;
import static com.itboye.hutouben.presenter.HomeMallPresenter.Driver_success;

/**
 * Created by itboye on 2016/12/5.
 */

public class ShopIngMallPresenter extends BasePresenter implements IShopIngMallInterface<String> {


    /**
     * 柴油机油
     */
    public static final String Diese_success = UserPresenter.class.getName()
            + "_Diese_success";
    public static final String Diese_fail = UserPresenter.class.getName()
            + "_Diese_fail";

//轮胎
    public static final String TyRe_success = UserPresenter.class.getName()
            + "_TyRe_success";
    public static final String TyRe_fail = UserPresenter.class.getName()
            + "_TyRe_fail";


    //阀门
    public static final String Valve_success = UserPresenter.class.getName()
            + "_Valve_success";
    public static final String Valve_fail = UserPresenter.class.getName()
            + "_Valve_fail";
    //汽配
    public static final String AutoParts_success = UserPresenter.class.getName()
            + "_AutoParts_success";
    public static final String AutoParts_fail = UserPresenter.class.getName()
            + "_AutoParts_fail";

    //车用尿素
    public static final String VehicleUrea_success = UserPresenter.class.getName()
            + "_VehicleUrea_success";
    public static final String VehicleUrea_fail = UserPresenter.class.getName()
            + "_VehicleUrea_fail";
    //余额查询
    public static final String Shengyu_success = ShopIngMallPresenter.class.getName()
            + "_Shengyu_success";
    public static final String Shengyu_fail = ShopIngMallPresenter.class.getName()
            + "_Shengyu_fail";

    //提现
    public static final String Tixian_success = ShopIngMallPresenter.class.getName()
            + "_Tixian_success";
    public static final String Tixian_fail = ShopIngMallPresenter.class.getName()
            + "_Tixian_fail";
    public ShopIngMallPresenter(Observer observer) {
        super(observer);
    }


    /****
     * 柴油基友
     * @param uid
     * @param id
     */
    @Override
    public void onShopIngMallDieselOil(String uid, String id) {
       IShopIngMallInterface<String> ShopIngMal=new ShopIngMallprinsitory(new ICompleteListener() {
           @Override
           public void success(ResultEntity result) {
               result.setEventTag(Tag_Success);
               result.setEventType(Diese_success);
               ShopIngMallPresenter.this.setChanged();
               ShopIngMallPresenter.this.notifyObservers(result);
           }

           @Override
           public void failure(ResultEntity result) {
               result.setEventTag(Tag_Error);
               result.setEventType(Diese_fail);
               ShopIngMallPresenter.this.setChanged();
               ShopIngMallPresenter.this.notifyObservers(result);

           }
       });
        ShopIngMal.onShopIngMallDieselOil(uid,id);
    }

    /**
     * 轮胎
     * @param uid
     * @param id
     */
    @Override
    public void onShopIngMallTyRe(String uid, String id) {
        IShopIngMallInterface<String> ShopIngMal=new ShopIngMallprinsitory(new ICompleteListener() {
            @Override
            public void success(ResultEntity result) {
                result.setEventTag(Tag_Success);
                result.setEventType(TyRe_success);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);
            }

            @Override
            public void failure(ResultEntity result) {
                result.setEventTag(Tag_Error);
                result.setEventType(TyRe_fail);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);

            }
        });
        ShopIngMal.onShopIngMallTyRe(uid,id);
    }

    /**
     * 阀门
     * @param uid
     * @param id
     */
    @Override
    public void onShopIngMllValve(String uid, String id) {
        IShopIngMallInterface<String> ShopIngMal=new ShopIngMallprinsitory(new ICompleteListener() {
            @Override
            public void success(ResultEntity result) {
                result.setEventTag(Tag_Success);
                result.setEventType(Valve_success);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);
            }

            @Override
            public void failure(ResultEntity result) {
                result.setEventTag(Tag_Error);
                result.setEventType(Valve_fail);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);

            }
        });
        ShopIngMal.onShopIngMllValve(uid,id);
    }

    /***
     * 汽配
     * @param uid
     * @param id
     */
    @Override
    public void onShopIngAutoParts(String uid, String id) {
        IShopIngMallInterface<String> ShopIngMal=new ShopIngMallprinsitory(new ICompleteListener() {
            @Override
            public void success(ResultEntity result) {
                result.setEventTag(Tag_Success);
                result.setEventType(AutoParts_success);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);
            }

            @Override
            public void failure(ResultEntity result) {
                result.setEventTag(Tag_Error);
                result.setEventType(AutoParts_fail);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);

            }
        });
        ShopIngMal.onShopIngAutoParts(uid,id);
    }

    /**
     * 车用尿素
     * @param uid
     * @param id
     */
    @Override
    public void onShopIngVehicleUrea(String uid, String id) {
        IShopIngMallInterface<String> ShopIngMal=new ShopIngMallprinsitory(new ICompleteListener() {
            @Override
            public void success(ResultEntity result) {
                result.setEventTag(Tag_Success);
                result.setEventType(VehicleUrea_success);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);
            }

            @Override
            public void failure(ResultEntity result) {
                result.setEventTag(Tag_Error);
                result.setEventType(VehicleUrea_fail);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);

            }
        });
        ShopIngMal.onShopIngVehicleUrea(uid,id);
    }

    @Override
    public void onMoney(String uid, String money, String account_id) {
        IShopIngMallInterface<String> ShopIngMal=new ShopIngMallprinsitory(new ICompleteListener() {
            @Override
            public void success(ResultEntity result) {
                result.setEventTag(Tag_Success);
                result.setEventType(Tixian_success);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);
            }

            @Override
            public void failure(ResultEntity result) {
                result.setEventTag(Tag_Error);
                result.setEventType(Tixian_fail);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);

            }
        });
        ShopIngMal.onMoney(uid,money,account_id);
    }

    @Override
    public void onMoneyYue(String uid) {
        IShopIngMallInterface<String> ShopIngMal=new ShopIngMallprinsitory(new ICompleteListener() {
            @Override
            public void success(ResultEntity result) {
                result.setEventTag(Tag_Success);
                result.setEventType(Shengyu_success);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);
            }

            @Override
            public void failure(ResultEntity result) {
                result.setEventTag(Tag_Error);
                result.setEventType(Shengyu_fail);
                ShopIngMallPresenter.this.setChanged();
                ShopIngMallPresenter.this.notifyObservers(result);

            }
        });
        ShopIngMal.onMoneyYue(uid);
    }

}
